<template>

    <div id='tem1'>
       <div class="left div" @click="sub">-</div>
        <div class="center div" v-text="count"></div>
        <div class="right div" @click="add">+</div>
    </div>

</template>


<script>
    export default{
        data(){
            return{
                count:1
            }
        },
        created(){

        },
        methods:{
            add(){
                this.count++;
                this.send()
            },
            sub(){
                this.count--;
                if(this.count<1){
                    this.count=1;
                }
                this.send()
            },
            send(){
               this.$emit('dataobj',this.count)
            }
        }
    }
</script>

<style scoped>
   #tem1 .div{
       text-align: center;
       width: 40px;
       height: 25px;
       border:1px solid #000;
       display: inline-block;
   }

</style>